{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 复习review on chapter 1 to chapter 8\n",
    "\n",
    "\n",
    "课本的chapter 1 直到chapter 8，构成了课程的的一部分：主要是python程序设计入门。\n",
    "主要内容可以概括为两个部分：\n",
    "1. python程序的结构\n",
    "2. 面向对象的基本概念与练习"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1 python程序的结构\n",
    "这里我们主要关心两个问题：\n",
    "1. 每一个python程序有哪些部分构成，以及它们之间的关系。由于当一个程序写完后，它的这写部分也就不变了，所以又称为静态结构。\n",
    "2. 每一个python程序在运行时，由那些部分构成，以及各部分之间的关系。却别于静态结构，又被称为动态结构\n",
    "\n",
    "\n",
    "**注意，程序的静态结构与动态结构密不可分，一边是静态结构决定可动态结构**\n",
    "\n",
    "关于python程序的结构，首先记住并弄清楚如下几个概念：\n",
    "\n",
    "\n",
    "** 1 statement（语句）：是python程序的最基本的组成单位，也是执行的基本单位。statement分为只有一行的简单statement，和多于一行的复杂语句**\n",
    "看下面的代码："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n",
      "3\n",
      "3\n",
      "3\n",
      "3\n",
      "3\n",
      "3\n",
      "3\n",
      "3\n",
      "3\n",
      "less than 10\n"
     ]
    }
   ],
   "source": [
    "#%%writefile review1/structure.py\n",
    "a = 1\n",
    "def fun1(p):\n",
    "    b = 2\n",
    "    return a+b\n",
    "for i in range(0,10):\n",
    "    c = fun1(i)\n",
    "    print(c)\n",
    "if c < 10:\n",
    "    print('less than 10')\n",
    "else:\n",
    "    prin('not less than 10')\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n"
     ]
    }
   ],
   "source": [
    "a = 1\n",
    "def test():\n",
    "    print('123')\n",
    "test.names = '123'\n",
    "dir(test)\n",
    "print(type(test.names))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "imort math\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
